Skip to content

Comments

fix(#0): Merge 방법 변경#16

Closed
Yoonchulchung wants to merge 1 commit intodevfrom
main
Closed

fix(#0): Merge 방법 변경#16
Yoonchulchung wants to merge 1 commit intodevfrom
main

Conversation

@Yoonchulchung
Copy link
Member

related_to : #7

📝 작업 내용

Main으로 merge할 때는 Squash가 아니라 기본 Merge 방법을 사용해야 Conflict가 발생하지 않습니다. 이거 생각을 못하고 있었어요

✅ 변경 사항

  • Main Merge할 때는 Squash가 아니라 기본 Merge 방법을 사용할 수 있도록 설정을 변경했습니다.

related_to : #7 

## 📝 작업 내용
자동 배포를 위한 CD 추가


## ✅ 변경 사항
- [x] cd-prod.yml 파일 추가
- [x] 서버에 .env 파일 추가 (노션 참고)


## 📷 스크린샷 (선택)


## 💬 리뷰어에게
Main 브랜치에 pr이 올라가야 작동하기 때문에, dev 브랜치 그대로 PR 날립니다. 
환경변수는 서버에 직접 .env 파일로 올려두었습니다. application-prod.yml을 기준으로 작동합니다.
(→ SPRING_PROFILES_ACTIVE=prod)

---------

Co-authored-by: Yoonchul Chung <84674889+Yoonchulchung@users.noreply.github.com>
Co-authored-by: yoonchulchung <yoonchul005@gmail.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Yoonchulchung, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 Main 브랜치 병합 시 발생할 수 있는 충돌을 해결하기 위해 병합 전략을 변경하고, 애플리케이션의 핵심 기반을 강화하는 데 중점을 둡니다. JWT 기반의 Spring Security를 도입하여 강력한 인증 및 권한 부여 시스템을 구축했으며, Swagger를 통해 API 문서화를 자동화하고, 전역 예외 처리기를 구현하여 애플리케이션의 견고성을 높였습니다. 또한, Checkstyle을 추가하여 코드 품질을 일관되게 유지하고, Docker 환경 설정을 개선하여 개발 및 배포 프로세스를 간소화했습니다. 이러한 변경 사항들은 프로젝트의 안정성, 유지보수성 및 개발 효율성을 크게 향상시킬 것입니다.

Highlights

  • 병합 전략 변경: Main 브랜치로 병합 시 Squash 대신 기본 병합 방식을 사용하여 잠재적인 충돌을 방지하도록 설정이 변경되었습니다.
  • 보안 및 인증 시스템 구축: Spring Security, JWT(JSON Web Token) 기반 인증, 사용자 세부 정보 관리 및 관련 필터가 추가되어 애플리케이션의 보안 기반이 마련되었습니다.
  • API 문서화 및 예외 처리: Swagger(OpenAPI)를 통한 API 문서화와 전역 예외 처리 메커니즘이 도입되어 API의 사용성과 안정성이 향상되었습니다.
  • 코드 품질 및 개발 환경 개선: Checkstyle 플러그인이 추가되어 코드 스타일 검사를 자동화하고, Docker 및 docker-compose 설정이 환경 변수를 활용하도록 개선되어 개발 환경의 유연성이 증가했습니다.
  • 공통 엔티티 및 응답 형식 추가: 생성 및 수정 시간을 자동으로 관리하는 BaseEntity, UpdateBaseEntity와 표준화된 API 응답 형식 CustomResponse가 도입되었습니다.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/cd-prod.yml
    • .github/workflows/pr-check.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이 PR은 머지 전략 변경에 대한 것이라고 되어 있지만, 실제로는 스프링 부트 애플리케이션의 전체적인 초기 설정을 포함하고 있습니다. 보안, JWT, JPA, Docker, Swagger, Checkstyle 등 많은 기능이 추가되었습니다. PR의 제목과 설명을 실제 변경 내용에 맞게 수정하는 것이 좋겠습니다. 전반적인 설정은 잘 되어 있으나, 몇 가지 중요한 수정 사항이 있습니다. 특히 JPA Auditing 설정 누락, 중복된 의존성, 사용되지 않는 파라미터 등의 문제를 수정해야 합니다. 자세한 내용은 각 파일에 대한 리뷰 코멘트를 참고해주세요.

Comment on lines +14 to +18
@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@NoArgsConstructor(access = lombok.AccessLevel.PROTECTED)
public abstract class BaseEntity {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

@CreatedDate와 같은 JPA Auditing 기능을 사용하려면, 애플리케이션의 메인 클래스나 설정 클래스에 @EnableJpaAuditing 어노테이션을 추가해야 합니다. 이 어노테이션이 없으면 createdAt 필드가 자동으로 채워지지 않아 null로 저장됩니다. RealMatchApplication 클래스에 추가하는 것을 권장합니다.

@EnableJpaAuditing
@SpringBootApplication
public class RealMatchApplication {
    // ...
}

Comment on lines +38 to 46
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// Test dependencies
testRuntimeOnly 'com.h2database:h2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

테스트 관련 의존성이 중복으로 선언되어 있습니다. 중복을 제거하고 그룹화하여 가독성을 높이는 것이 좋습니다.

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
    testRuntimeOnly 'com.h2database:h2'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

this.isDeleted = false;
}

public void softDelete(Integer deletedBy, LocalDateTime deletedAt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

softDelete 메소드의 deletedBy 파라미터가 사용되지 않고 있습니다. 만약 삭제한 사용자를 기록할 의도였다면, UpdateBaseEntitydeletedBy 필드를 추가하고 이 메소드에서 값을 설정해야 합니다. 그렇지 않다면 불필요한 파라미터를 제거하는 것이 좋습니다.

Suggested change
public void softDelete(Integer deletedBy, LocalDateTime deletedAt) {
public void softDelete(LocalDateTime deletedAt) {

public SecurityFilterChain securityFilterChain(HttpSecurity http, CustomAuthEntryPoint customAuthEntryPoint, CustomAccessDeniedHandler customAccessDeniedHandler) throws Exception {
http
.cors(cors -> cors.configurationSource(corsConfigurationSource()))
.csrf(csrf -> csrf.disable())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

JWT를 사용한 인증 방식에서는 서버가 세션을 유지할 필요가 없으므로, 세션 관리 정책을 STATELESS로 설정하는 것이 중요합니다. 이렇게 하면 불필요한 세션 생성을 막고 메모리 사용을 줄일 수 있으며, 완전한 무상태(stateless) 아키텍처를 유지할 수 있습니다.

Suggested change
.csrf(csrf -> csrf.disable())
.csrf(csrf -> csrf.disable())
.sessionManagement(session -> session.sessionCreationPolicy(org.springframework.security.config.http.SessionCreationPolicy.STATELESS))

Comment on lines 39 to +46
environment:
- SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/myapp_db?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul
- SPRING_DATASOURCE_USERNAME=admin
- SPRING_DATASOURCE_PASSWORD=secret
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.cj.jdbc.Driver
- SPRING_REDIS_HOST=redis
- SPRING_REDIS_PORT=6379
- SPRING_PROFILES_ACTIVE=dev

SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL}
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}
SPRING_DATASOURCE_DRIVER_CLASS_NAME: ${SPRING_DATASOURCE_DRIVER_CLASS_NAME}
SPRING_REDIS_HOST: ${SPRING_REDIS_HOST}
SPRING_REDIS_PORT: ${SPRING_REDIS_PORT}
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

env_file을 통해 .env 파일의 변수들을 이미 컨테이너로 전달하고 있으므로, environment 섹션에서 동일한 변수들을 다시 선언하는 것은 불필요합니다. 코드를 더 간결하게 유지하기 위해 이 블록을 제거하는 것을 고려해보세요. Docker Compose는 env_file에 정의된 변수들을 자동으로 환경 변수로 설정해줍니다.

.claim("role", role)
.issuedAt(new Date(now))
.expiration(new Date(now + expireMillis))
.signWith(secretKey, SignatureAlgorithm.HS256)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

signWith(secretKey, SignatureAlgorithm.HS256) 메소드는 jjwt 라이브러리에서 더 이상 사용되지 않는(deprecated) 방식입니다. secretKeyHS256 알고리즘을 사용하도록 생성되었으므로, 알고리즘을 명시적으로 지정할 필요가 없습니다. signWith(secretKey)만 사용하도록 수정하는 것이 좋습니다. 이렇게 하면 코드가 더 간결해지고 최신 라이브러리 버전에 맞게 됩니다.

Suggested change
.signWith(secretKey, SignatureAlgorithm.HS256)
.signWith(secretKey)

"잘못된 요청입니다."),

INVALID_DATA(HttpStatus.BAD_REQUEST,
"COMMON4001_2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

에러 코드 COMMON4001_2에 오타가 있는 것 같습니다. 다른 코드들과의 일관성을 위해 COMMON400_2로 수정하는 것이 좋아 보입니다.

Suggested change
"COMMON4001_2",
"COMMON400_2",

@Yoonchulchung Yoonchulchung deleted the main branch January 17, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants